package cn.tedu._02notice_test.base.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Jsonresult {
    private Integer state;
    private String message;
    private Object data;

    public Jsonresult (StatusCode statusCode) {
        this.state = statusCode.getState();
        this.message = statusCode.getMessage();
    }

    public Jsonresult (StatusCode statusCode,Object data) {
        this.message = statusCode.getMessage();
        this.state = statusCode.getState();
        this.data = data;
    }
    public static Jsonresult ok(Object data){
        return new Jsonresult(StatusCode.OPERATION_SUCCESS,data);
    }
    public static Jsonresult ok(){
        return Jsonresult.ok(null);
    }
}
